package Medir.java;

import java.util.Random;

public class MainHeapSort {
	private static float[] NewCopy(float[] A)
	{
		float[] B = new float [A.length+1];
		for(int k = 1; k < B.length; k++)
			B[k] = (float) A[k-1];
		B[0] = Integer.MIN_VALUE;
		return B;
		
	}
	public static void PrintArray(float[] A)
	{
		System.out.println();
		for(int i = 1; i < A.length; i++)
			System.out.format("%3d", i);
		System.out.println();
		for(int i = 1; i < A.length; i++)
			System.out.format("%.2f", A[i]);
		
	}
	
	public static void main(String[] args)
	{
		//int [] C = {4,1,3,2,16,9,10,14,8,7};
		int a1 = 100;
		float[] A = new float[a1];
        Random randomValue = new Random();
        for (float i = 0; i < 99; i++) // para manter ate 100
        {
            A[(int) i] = randomValue.nextFloat();
            //System.out.print(A[i]);
        }
		float [] A1 = NewCopy(A);
		PrintArray(A);
		@SuppressWarnings("unused")
		HeapSort hs = new HeapSort(A);
		
		PrintArray(A);
	}

}
